#include "rocc.h"
#include "util.h"

#ifndef CIM144_H_H
#define CIM144_H_H

#define ROCC_config(config) \
	ROCC_INSTRUCTION_SS(0,config,0,2)

#define ROCC_push(addr,push_rs2) \
	asm volatile("fence");			\
	ROCC_INSTRUCTION_SS(0,addr,push_rs2,17); \
	asm volatile("fence":::"memory")

#define ROCC_mvm(num_config,start_index) \
	ROCC_INSTRUCTION_SS(0,num_config,start_index,1)

#define ROCC_save(addr,save_rs2) \
	asm volatile("fence");			\
	ROCC_INSTRUCTION_SS(0,addr,save_rs2,18); \
	asm volatile("fence":::"memory")

#define RoCC_mac(rd,rs1,rs2)\
	asm volatile("fence");\
	ROCC_INSTRUCTION_DSS(1,rd,rs1,rs2,1);\
	asm volatile("fence":::"memory")

#endif
// // 1 .config
// __STATIC__FORCEINLINE  void ROCC_config(uint64_t config){
// 	ROCC_INSTRUCTION_SS(0,config,0,2);
// }
// // 2. push 17
// __STATIC__FORCEINLINE  void ROCC_push(int64_t addr ,uint64_t push_rs2){
// 	asm volatile("fence");
// 	ROCC_INSTRUCTION_SS(0,addr,push_rs2,17);
// 	asm volatile("fence":::"memory");
// }
// // 3. mvm  1
// __STATIC__FORCEINLINE  void ROCC_mvm(uint64_t num_config ,uint64_t start_index){
// //	asm volatile("fence");
// 	ROCC_INSTRUCTION_SS(0,num_config,start_index,1);
// //	asm volatile("fence":::"memory");
// }
// // 4. save 18
// __STATIC__FORCEINLINE void ROCC_save(int64_t addr ,uint64_t save_rs2){
// 	asm volatile("fence");
// 	ROCC_INSTRUCTION_SS(0,addr,save_rs2,18);
// 	asm volatile("fence":::"memory");
// }

